<?php

namespace app\logic\main;

use linkphp\Application;

class Download
{

    public function push()
    {
        if(!Application::httpRequest()->isPost())return ['code' => 2, 'msg' => '非法提交!'];
        if(Application::input('post.title') == '')return ['code' => 2, 'msg' => '标题不能为空!'];
        if(Application::input('post.desc') == '')return ['code' => 2, 'msg' => '内容不能为空!'];
        if($user = Application::get('auth')->getUserInfo()){
            return Application::get('downloadData')->push();
        } else {
            return ['code' => 2, 'msg' => '未登入'];
        }
    }

    public function getDownList()
    {
        return Application::get('downloadData')->getDownList();
    }

    public function orderVip($user)
    {}

    public function getItem()
    {
        return Application::get('downloadData')->getItem();
    }

}